﻿@model Entities.Products

@{
    ViewBag.Title = "Edit";
}

<h2>Edit</h2>

@using (Html.BeginForm()) {
    @Html.AntiForgeryToken()
    @Html.ValidationSummary(true)

    <fieldset>
        <legend>Products</legend>

       
            @Html.HiddenFor(model => model.ProductID)
          
       

        <div class="editor-label">
            @Html.LabelFor(model => model.ProductName)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ProductName)
            @Html.ValidationMessageFor(model => model.ProductName)
        </div>

       <div class="editor-label">
            Supplier
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.SupplierID, (IEnumerable<SelectListItem>) ViewBag.Suppliers)
            @Html.ValidationMessageFor(model => model.SupplierID)
        </div>

        <div class="editor-label">
           Category
        </div>
        <div class="editor-field">
            @Html.DropDownListFor(model => model.CategoryID, (IEnumerable<SelectListItem>) ViewBag.Categories)
            @Html.ValidationMessageFor(model => model.CategoryID)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.QuantityPerUnit)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.QuantityPerUnit)
            @Html.ValidationMessageFor(model => model.QuantityPerUnit)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UnitPrice)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UnitPrice)
            @Html.ValidationMessageFor(model => model.UnitPrice)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UnitsInStock)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UnitsInStock)
            @Html.ValidationMessageFor(model => model.UnitsInStock)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.UnitsOnOrder)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.UnitsOnOrder)
            @Html.ValidationMessageFor(model => model.UnitsOnOrder)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ReorderLevel)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.ReorderLevel)
            @Html.ValidationMessageFor(model => model.ReorderLevel)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Discontinued)
        </div>
        <div class="editor-field">
            @Html.EditorFor(model => model.Discontinued)
            @Html.ValidationMessageFor(model => model.Discontinued)
        </div>

        <p>
            <input type="submit" value="Save" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}
